<?php

require_once('ContentFactory.php');

$a = new ContentFactory();
try {
	$result = $a->getLatestContent();
	$result = $result[0];
	print("<html>");
	print("<h1> {$result->getTitle()}</h1>");
	$date = $result->getDate()->format('Y-m-d');
	print("<h3> Written: {$date} </h3>");
	print("<p> {$result->getContent()} </p>");
	print("<h4> Comments </h4>");
	foreach($result->getComments() as $comment) {
		print($comment['author']);
		print("<br />");
		print($comment['comment']);
	}
	print("<h4> Tags </h4>");
	
	foreach($result->getTags() as $tag) {
		print($tag);
		print("<br />");
	}
	
	print("</html>");

} catch (NoSuchArticleException $ae ){
	print"Oops!";
}